UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AU5fGDO826peHicGA+b0Q8qekoKPDrZctFIZTcIaz5E=' 
WHERE 
  key_id = '7e46af99db747bb94ea853e0218534a78a7319150ad11ddd973b28178ad2c759' 
  AND (
    token = 'AU5fGDO826peHicGA+b0Q8qekoKPDrZctFIZTcIaz5E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044