UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HVi9H1Udy0Mcbjb5BvNUkMSRF4JfEUIis6mIdBbOiXo=' 
WHERE 
  key_id = 'bf6fccc2e07eab750db3e1836de6824d7325bfadcf973ba63dbd41f31801b63a' 
  AND (
    token = 'HVi9H1Udy0Mcbjb5BvNUkMSRF4JfEUIis6mIdBbOiXo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030