UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Qx2pegPgOtvRp613Ucwzxrgz+56UGDV0e/np4EiuJNY=' 
WHERE 
  key_id = 'cb38ae3115421989117bf8f4cee8c876a521fe8c80e760dc7d90bb7e15bfa3ac' 
  AND (
    token = 'Qx2pegPgOtvRp613Ucwzxrgz+56UGDV0e/np4EiuJNY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018