UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n3hedj8ITspt5yhrC1RkrZGC6QGF100v9CjrXh8bCHY=' 
WHERE 
  key_id = '1c48410b9fcd135a41057591186e78972a88b3fb1271389cc1589a5c4de3942b' 
  AND (
    token = 'n3hedj8ITspt5yhrC1RkrZGC6QGF100v9CjrXh8bCHY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035