UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NBNIAQKFORk0DrHseYvqwc7HagKoFv6DwGVCmUAd0OM=' 
WHERE 
  key_id = '4d073d2e37143f79baa3d798651f6a192bde17c7496a6152c0b77760b91f29cf' 
  AND (
    token = 'NBNIAQKFORk0DrHseYvqwc7HagKoFv6DwGVCmUAd0OM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053