UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EZn7qgTTJvTEGJtF7XrYY5mjgh1qhc11wX5oQyOMsms=' 
WHERE 
  key_id = '8d6a9a18f314f52cc22e3329f111683fa2a5bec82a8e3feb59bc8923ab124ead' 
  AND (
    token = 'EZn7qgTTJvTEGJtF7XrYY5mjgh1qhc11wX5oQyOMsms=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029