UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'scg6GXX2b6pCk9FQirbxOzkVxRNtTa46YoJOCZCujSc=' 
WHERE 
  key_id = 'f9da54a09352120903d03a281c35f4166b04ff6ee73a76381b9dbb9447ff6efa' 
  AND (
    token = 'scg6GXX2b6pCk9FQirbxOzkVxRNtTa46YoJOCZCujSc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00014