UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CyWkMYA9AdXtMPMUzgRcO7BKPJGM0f6z/o9iQEo4f+w=' 
WHERE 
  key_id = '2404fac9127d2e380665de26a9e81b59bf9100e134badfe5abd48483a5861e29' 
  AND (
    token = 'CyWkMYA9AdXtMPMUzgRcO7BKPJGM0f6z/o9iQEo4f+w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028