UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fJLKXK5YUX8iZS+jjqGeEJ96b+zeWCxa9GOWc7YHofk=' 
WHERE 
  key_id = '5d5a9b766e2a5b3c6401e06a1a22c07ccda6979547171196c8e5569189d679d3' 
  AND (
    token = 'fJLKXK5YUX8iZS+jjqGeEJ96b+zeWCxa9GOWc7YHofk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028