UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KFAFQwUmb6isWtNIfbmsYchQUldnhrp7ptHBACbTnY4=' 
WHERE 
  key_id = 'cecaf234493184f03b7f00d97402013e04b59a04bba657c713dfd3b5c33b8fff' 
  AND (
    token = 'KFAFQwUmb6isWtNIfbmsYchQUldnhrp7ptHBACbTnY4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026