UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5SxAt2n7LMebdPtwKvM2OQplfUOS2GdCJZELmg0zxtM=' 
WHERE 
  key_id = '7f9139929f7124889436e070f8011aa26017e32ce5640d391f1a0df613418193' 
  AND (
    token = '5SxAt2n7LMebdPtwKvM2OQplfUOS2GdCJZELmg0zxtM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030