UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jwB8ljGRV+ku8KkYRMxGruX6104ZmPLLDdLrvNtXOZw=' 
WHERE 
  key_id = '038673ed4795be18353cf6306300c47c368aa8078ffef9cd971497dc73745135' 
  AND (
    token = 'jwB8ljGRV+ku8KkYRMxGruX6104ZmPLLDdLrvNtXOZw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050