UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'L4kalfRyZXcO2JpqJyksWta27+Qn0/08Yd9b5rt3Wxo=' 
WHERE 
  key_id = '6b71b314226264f6a11c053ba635a1a16766079e464194537c975c9f8a1e7f55' 
  AND (
    token = 'L4kalfRyZXcO2JpqJyksWta27+Qn0/08Yd9b5rt3Wxo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025