UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'q4ZZa2jAWDi6h9lvkembmnZ6ktKpkuRwBOedBaEnxpo=' 
WHERE 
  key_id = '6cc6d1cd66d04f508f6ad2e75b4fad079a5a5536cbf7a2d45a603db553b04e51' 
  AND (
    token = 'q4ZZa2jAWDi6h9lvkembmnZ6ktKpkuRwBOedBaEnxpo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042