UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BgU3/NOIeAoj2Gar0f2nPm6oUnTB4Y5LenBxV+zfSto=' 
WHERE 
  key_id = '1b79addeffc2135169b1694493ed148085a1b8651f32a6a080ef81eca61e9f86' 
  AND (
    token = 'BgU3/NOIeAoj2Gar0f2nPm6oUnTB4Y5LenBxV+zfSto=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032