UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pGtULF+YJ8BarNoUO8KVHNZOF6g0+F/DX7TsmJztd5c=' 
WHERE 
  key_id = '9b16f7d1d27bf2d7e0352230493010d0910003b11413422e501b6cd547ce2a22' 
  AND (
    token = 'pGtULF+YJ8BarNoUO8KVHNZOF6g0+F/DX7TsmJztd5c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030