UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ScfRjJoEYgztdiLlw60MxEfviRFd1QW/Vitr4VBJp8Q=' 
WHERE 
  key_id = '78a53c5b802eb1e8a065b467a7bd5d1dcb09fc356f147ddd105433697b3ff369' 
  AND (
    token = 'ScfRjJoEYgztdiLlw60MxEfviRFd1QW/Vitr4VBJp8Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031