UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DHj7EzFiATTy+23usGlvyrOifMPgj3D/tYw29rXvNaM=' 
WHERE 
  key_id = '1c91d9c7bcae855f7a1b89567d89cf10ba18c70b9ca1c5775b9bb88b6b9f5022' 
  AND (
    token = 'DHj7EzFiATTy+23usGlvyrOifMPgj3D/tYw29rXvNaM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024