UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AI7gMWwxD6sTNarITjOG4F1CyrTYDx/aIZBh6L9Qpeg=' 
WHERE 
  key_id = '508d6e308cd33a182288091fbbe371d1635c07c644008d8f9caf1018c99104c7' 
  AND (
    token = 'AI7gMWwxD6sTNarITjOG4F1CyrTYDx/aIZBh6L9Qpeg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00098