UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'e+WXufF27LJ+Hmi0OSjI0uI6W/hqLCOKpc3zcJ0mYm0=' 
WHERE 
  key_id = '0aa46d1a2c0376569f6395cd3f4fe9a4453dff2fa39344b8a43f88eeb99f16b6' 
  AND (
    token = 'e+WXufF27LJ+Hmi0OSjI0uI6W/hqLCOKpc3zcJ0mYm0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016