UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oMwqI1DJa5+ZRGcERdAEPpOA78kCtAJiifAY6IrggUI=' 
WHERE 
  key_id = 'b897fc8092035e6d84746ef800502da03bb686f1c9e7b1364bca169b6b913541' 
  AND (
    token = 'oMwqI1DJa5+ZRGcERdAEPpOA78kCtAJiifAY6IrggUI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025