UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'v+/GhBcnXDcO9wNdJOVr2xMqP5lbEcbZQKs2oGmdt/w=' 
WHERE 
  key_id = 'b80f1c788408bf3122a1172712ad3e931948899f4162c042f723048347754cc5' 
  AND (
    token = 'v+/GhBcnXDcO9wNdJOVr2xMqP5lbEcbZQKs2oGmdt/w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035