UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gByjvGcuWEzODVBhb2+xL2ZaE57EK/leyebLbSeOGDc=' 
WHERE 
  key_id = 'a9ef502d63c8b7ee5709abb9869f88d6c823d056b71172cb77c12365629196df' 
  AND (
    token = 'gByjvGcuWEzODVBhb2+xL2ZaE57EK/leyebLbSeOGDc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022