UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'swVRn5g4G3hgALbhHuEa+tzKdhvUr53iU6weSDON7Gg=' 
WHERE 
  key_id = '6600b4b7a5b3118e2b19a100b530401ef6869fc8fea442624c7c9526956f8be3' 
  AND (
    token = 'swVRn5g4G3hgALbhHuEa+tzKdhvUr53iU6weSDON7Gg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018