UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'REE7dR1VpWZP4+bRQ+HKX0l7WJ1O+G3WuteDnyx64Fw=' 
WHERE 
  key_id = '1bbdcb979b21b5f8a9eebad7eee26b744427bcff8a0ff42c9842383a746a907d' 
  AND (
    token = 'REE7dR1VpWZP4+bRQ+HKX0l7WJ1O+G3WuteDnyx64Fw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028