UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sSCGnkXUVTZgmJROA99inblEVn8w/axUawM2fijUhNA=' 
WHERE 
  key_id = 'df05375bcfe42ac4468e5c9c8966733a5a4c62ded6575eb222b681d904e224d5' 
  AND (
    token = 'sSCGnkXUVTZgmJROA99inblEVn8w/axUawM2fijUhNA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050