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

Query time 0.00030