UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XZJb9aZofH5U8O/qnawHsqEQbUmjyIO4rCc1K7xdmKk=' 
WHERE 
  key_id = '8ee57e5b4dc32e5d1fd0fafd7d296052ca08559560f8c2dcbe8ccc85f2f047ce' 
  AND (
    token = 'XZJb9aZofH5U8O/qnawHsqEQbUmjyIO4rCc1K7xdmKk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037