UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qP1o5abm6ABPOqQixc2ewPFtgujPCuGK0BIV+DdZCCI=' 
WHERE 
  key_id = 'd1bd046b673ec1362a91e55deeefc055c6f05022c79504ecc5987fdf74783f0f' 
  AND (
    token = 'qP1o5abm6ABPOqQixc2ewPFtgujPCuGK0BIV+DdZCCI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047