UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IpJd+dxMeooDbG04uKD/pWsXeSqDYiPodojGV8xAj7k=' 
WHERE 
  key_id = '4ed889d43f9051c629fdaf35b0cd95641ac170fbb72b573bfb9c3b3f12db339c' 
  AND (
    token = 'IpJd+dxMeooDbG04uKD/pWsXeSqDYiPodojGV8xAj7k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034