UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UoDxfjOxoM5gri6OXCbRTnbOwI9lpOwD17g6+ldyMMM=' 
WHERE 
  key_id = '2be52ccb71870c207249cc9d41843dbe19e1b72e7b98e93189ff96dfd7287560' 
  AND (
    token = 'UoDxfjOxoM5gri6OXCbRTnbOwI9lpOwD17g6+ldyMMM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030