UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P589R4dewJyPVgEaokP07WZ/7AC7pNb48H86Wc2579U=' 
WHERE 
  key_id = '54693e7a3c1c01567e3aa37e76fb6c9729a4a2f5d9d200ce884571cbbcd6cdb2' 
  AND (
    token = 'P589R4dewJyPVgEaokP07WZ/7AC7pNb48H86Wc2579U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027