UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'orheIsioCXsm4BGffvJAxgjvACX+tsCgMmuiN4FuUwk=' 
WHERE 
  key_id = '6a6d4017a886b03207555d8d290015b963b196e49d1c8d575c697fc68fd0f9fa' 
  AND (
    token = 'orheIsioCXsm4BGffvJAxgjvACX+tsCgMmuiN4FuUwk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033