UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'X3MHmz33cLR1ZpCtabU4x6LJ+8hyWGF184nbvm1TAsE=' 
WHERE 
  key_id = '555bacd900914f2536d77e3566f88c80e9c902f77d5d67f4cb4c10fc87581dc0' 
  AND (
    token = 'X3MHmz33cLR1ZpCtabU4x6LJ+8hyWGF184nbvm1TAsE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022