UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rSjapEgC+zFfiEVEygbJppAwdPO5SxQsYbewCZhCxfM=' 
WHERE 
  key_id = 'e0074939d46f4bcc07558170d4709b9a359216c340937f732cb4f39fbaf94980' 
  AND (
    token = 'rSjapEgC+zFfiEVEygbJppAwdPO5SxQsYbewCZhCxfM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048