UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Nt1DM7ci9EIVwBcdLGd+Pqp8ppWmGFHOptVBmCleYVw=' 
WHERE 
  key_id = '30da4cacf64f0324e0f7b3f59d95e127e0c9e92e739b04ec26b3fd78282d7846' 
  AND (
    token = 'Nt1DM7ci9EIVwBcdLGd+Pqp8ppWmGFHOptVBmCleYVw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040