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

Query time 0.00054