UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sA/oB0D3qFsNxQp9406p/QRA9P0zF2SNdAg5pmzmzro=' 
WHERE 
  key_id = 'd45f5bd519cb297c67c464b4a81d330176c919de2bcf2e8b8ced1b2d54efae50' 
  AND (
    token = 'sA/oB0D3qFsNxQp9406p/QRA9P0zF2SNdAg5pmzmzro=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038