UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZGFW5NwnRjlF5fIETh8lTnVPrOOWKrAlF4i+7ps2DFI=' 
WHERE 
  key_id = '9874a911e49e4c0d898186556531db431d9ad6aa69e8a3491246958f48e5d625' 
  AND (
    token = 'ZGFW5NwnRjlF5fIETh8lTnVPrOOWKrAlF4i+7ps2DFI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038