UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'w015RcKrO8gQv//rRKNOGcLm4E54z/M3cMZ9hgtup68=' 
WHERE 
  key_id = 'dc98c193b554ad2c7ea0684dd4347470d6034233c691c6a7cab022e562d2a96c' 
  AND (
    token = 'w015RcKrO8gQv//rRKNOGcLm4E54z/M3cMZ9hgtup68=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045