UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MYj+QsYg0cBuUWTtO5pHJxXP5m5dhIa2VB/9ad/gXxM=' 
WHERE 
  key_id = 'f641b8a60eda976e743b52795332ac22e9b62eb9729880b8742855deca7cc02f' 
  AND (
    token = 'MYj+QsYg0cBuUWTtO5pHJxXP5m5dhIa2VB/9ad/gXxM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00013