UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IXw7ujKcxSyu2DZZK1rL+4jlaeOyb/m2UlZs+ZwvseY=' 
WHERE 
  key_id = '197f306e7d1835359f46a9bd1d893c7a45d33fee9d1e1f734e6e4c2824532296' 
  AND (
    token = 'IXw7ujKcxSyu2DZZK1rL+4jlaeOyb/m2UlZs+ZwvseY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028