UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'w2K+vzsyT50ITDDPTwMdJ/v9zHK1JExiERwdrgTOT7k=' 
WHERE 
  key_id = '77e9818020dd445b3e41bbedb4dd6c6de236ae41925d960e9fad5d9d4e81880c' 
  AND (
    token = 'w2K+vzsyT50ITDDPTwMdJ/v9zHK1JExiERwdrgTOT7k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019