UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dtjgVuqtDaLP9LNXri2bo0wEXUWIEb8jFRKs+t9AfAg=' 
WHERE 
  key_id = 'd42285d9da338847a93ea5aec90fc1ae68e5519e742b3149af6431d235f50c47' 
  AND (
    token = 'dtjgVuqtDaLP9LNXri2bo0wEXUWIEb8jFRKs+t9AfAg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037